package cn.clwxy.gdz.service;

import java.util.List;

import org.apache.commons.dbutils.handlers.BeanListHandler;

import cn.clwxy.gdz.bo.TeacherInfoPageOrderListBean;
import cn.clwxy.gdz.util.BaseDao;

public class TeacherInfoPageOrderListBeanDaoImpl extends BaseDao implements TeacherInfoPageOrderListBeanDao{

	@Override
	public List<TeacherInfoPageOrderListBean> getTeacherInfoPageOrderListBeanByTeacherId(
			Integer teacherId) {
		String sql="SELECT o.orderId ,GROUP_CONCAT(sj.subjectName) subjectName,g.gradeName,o.profit,o.orderBeginTime,o.teacherId"+
				" FROM `order` o INNER JOIN ordersubjectrelative os ON os.orderId=o.orderId"+
				" INNER JOIN `subject` sj ON sj.subjectId=os.subjectId INNER JOIN student s ON s.studentId=o.studentId INNER JOIN grade g ON s.studentGradeId=g.id"+
				" WHERE o.teacherId=? GROUP BY o.orderId ORDER BY o.orderId";
		return super.queryList(sql, new BeanListHandler<TeacherInfoPageOrderListBean>(TeacherInfoPageOrderListBean.class), teacherId);
	}

}
